﻿package mortal.game.view.vip.panel
{
    import flash.events.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.game.manager.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.systemSetting.*;

    public class VipFirstRechargeIcon extends ActionBaseIcon
    {
        private var _timerView:SecTimerView;
        private static var _instance:VipFirstRechargeIcon;

        public function VipFirstRechargeIcon()
        {
            super(ResFileConst.VipFirstRechargeIcon);
            this.name = "VipFirstRechargeIcon";
            return;
        }// end function

        override public function show(param1:int = 0, param2:int = 0) : void
        {
            super.show(param1, param2);
            var _loc_3:* = 1800 - (ClockManager.instance.nowDate.time / 1000 - ClientSetting.local.guideVipTime);
            if (_loc_3 > 0)
            {
                this.setLeftTime(_loc_3);
            }
            return;
        }// end function

        public function setLeftTime(param1:int) : void
        {
            var _loc_2:GTextFormat = null;
            if (this._timerView == null)
            {
                _loc_2 = GlobalStyle.textFormatLv;
                this._timerView = UIFactory.secTimeView("mm:ss", 13, 50, 100, 20, this, _loc_2);
                this._timerView.filters = [FilterConst.glowFilter];
            }
            this._timerView.setLeftTime(param1, true);
            this._timerView.timeOutHandler = this.timeOutHandler;
            return;
        }// end function

        private function timeOutHandler() : void
        {
            if (!this.isHide)
            {
                this.hide();
            }
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            btn.name = "VipFirstRechargeIcon";
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            btn.name = "";
            super.disposeImpl(param1);
            if (this._timerView != null)
            {
                this._timerView.stop();
                this._timerView.dispose(param1);
                this._timerView = null;
            }
            return;
        }// end function

        override protected function clickHandler(event:MouseEvent) : void
        {
            VipFirstRechargeWin.instance.show();
            return;
        }// end function

        public static function get instance() : VipFirstRechargeIcon
        {
            if (!_instance)
            {
                _instance = new VipFirstRechargeIcon;
            }
            return _instance;
        }// end function

    }
}
